<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>WelCome to HuNan University JudgeOnline</title>
    <link rel="stylesheet" href="../style/nav.css" >
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="../css/bootstrap.min.css">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css">

    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="../js/jquery-3.3.1.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="../js/bootstrap.min.js"></script>
    <script src="./js/controller.js"></script>
    <script src="./js/myajax.js"></script>
</head>
<body>
    <div class="container">
        <!-- page head -->
        <div class="head-logo">
            <img alt="hnulogo" src="../img/hnulogo.gif">
            <h2>Welcome To Hunan University Judge Online</h2>
            <img alt="acmlogo" src="../img/acm.png" class="img-circle icpc" />
        </div>
        <div class="masthead">
            <ul class="nav nav-pills">
                <li id="home"><a href="../index">Home</a></li>
                <li id="problem"><a href="problem">Problem</a></li>
                <li id="status"><a href="status">Status</a></li>
                <li id="rank"><a href="rank">Rank List</a></li>
                <li id="discuss"><a href="discuss">Discuss</a></li>
                <li id="printer"><a href="printer">Printer</a></li>
                <li class="pull-right" id="info">
                    <button type="button" class="btn btn-primary" onclick="window.location='login'">Login</button>
                </li>
            </ul>
        </div>

        <!-- Site content-->
        <div class="row">
            <div class="col-md-2 col-md-offset-4 column" style="margin-top: 5em; margin-bottom: 5em">
                    <div>
                        <span id="warning" class="wa"></span>
                    </div>
                    <div class="form-group">
                            <label for="userName">User Name</label>
                            <input type="text" class="form-control" id="userName" />
                    </div>
                    <div class="form-group">
                            <label for="password">Password</label>
                            <input type="password" class="form-control" id="password" />
                    </div>
                    <div style="margin-top: 2em; margin-bottom: 2em">
                        <button id="submit1" type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">Submit</button>
                        <button id="reset" type="button" class="btn btn-default" style="margin-left: 2em">Reset</button>
                    </div>
            </div>
        </div>
        <!--（Modal） -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel">验证码</h4>
                    </div>
                    <div class="modal-body">
                        <a href="#" onclick="getVerifyCode('myimg')"><img alt="vevifyCode" id="myimg" /></a>
                        <br />
                        <br />
                        Verify Code is:
                        <br />
                        <input id="verifyCode" type="text" class="form-control" style="width: 12em"/>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button id="submit" type="button" class="btn btn-primary" data-dismiss="modal">Submit</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
  
        <!-- Site footer -->
        <footer class="footer">
            <p>&copy; HNU ACM Team | <a href="#">Contact Us</a> | Version 2018</p>
            <p>Developer：balabala</p>
        </footer>
  
    </div>
</body>
<script src="./js/afterload.js"></script>
<script>
    $("#reset").click(function() {
        $("#userName").val("");
        $("#password").val("");
    });
    var contestId = getUrlVar("contestId");
    $("#submit1").click(function() {
        getVerifyCode("myimg");
    });
    $("#submit").click(function() {
        var jsonData = new Object();
        jsonData.name = document.getElementById("userName").value;
        jsonData.password = document.getElementById("password").value;
        jsonData.verifyCode = document.getElementById("verifyCode").value;
        jsonData.uuid = sessionStorage.getItem("uuid").toString();
        jsonData.contestId = String(contestId);
        var data = new Object();
        data.data = jsonData;
        // console.log(userName + "\n" + password + "\n" + verifyCode + "\n" + uuid);
        // document.getElementById("warning").textContent = "Error";
        login("warning", data);
    });
</script>
</html>